package org.stvd.repository.workflow.impl;

import java.util.List;

import org.springframework.stereotype.Repository;
import org.stvd.core.dto.QueryResult;
import org.stvd.entities.workflow.WfReflect;
import org.stvd.repository.base.impl.BaseDaoImpl;
import org.stvd.repository.workflow.WfReflectDao;

@Repository("WfReflectDao")
public class WfReflectDaoImpl extends BaseDaoImpl<WfReflect> implements WfReflectDao {

    public QueryResult<WfReflect> getQueryResult(int start, int limit) {
        return getQueryResultByHQL(start, limit, "from WfReflect ");
    }
    
    public WfReflect findByRequestUrl(String requestUrl, String requestMethod) {
        List<WfReflect> list = findByHQL("from WfReflect where requestUrl = ?0 and requestMethod = ?1 ", 
                requestUrl, requestMethod);
        if(list != null && list.size() > 0){
            return list.get(0);
        }
        return null;
    }

    public List<WfReflect> findByRequestUrl(String requestUrl) {
        return findByHQL("from WfReflect where requestUrl = ?0",requestUrl);
    }
}
